* Create results tables for:
* Unions, Class Identification and Policy Attitudes
* Date: 03/31/22


*******************************************************************************
***** Tables.
*******************************************************************************


* Descriptive tables.
use GSS_SubClass_clean.dta, clear

*** TABLE 1. ***
estpost tabstat inc5 edu5 egp5rev, by(objcls5) 
esttab using "Table_1.tex" , replace style(tex) cells("inc5(fmt(1)) edu5 egp5rev") label nodepvar noobs nomtitle nonumber title(Average Income, Education, and EGP by Latent Objective Class Categories\label{tab:desc.obj})

*** TABLE 2. ***
estpost tab subcls objcls5 
esttab using "Table_2.tex" , replace style(tex) cell(colpct(fmt(1))) unstack noobs varlabels(`e(labels)') nomtitle nonumber title(Cross Tabulation Between Subjective Class and Objective Class\label{tab:desc.subobj})


* YPSS subjective class and unions results.

* Labels.
local vnamesYP1 "workcls_1 workcls_t1 union_1 union_t1 edu_1 edu_t1 inc_1 inc_t1 ideo_1 ideo_t1 female_1 female white_1 white workcls_2 workcls_t1 union_2 union_t1 edu_2 edu_t1 inc_2 inc_t1 ideo_2 ideo_t1 female_2 female white_2 white L.workcls_ workcls_t1 L.union_wi union_t1 L.edu_wi edu_t1 L.inc_wi inc_t1 L.ideo_wi ideo_t1 L.workcls_wi workcls_t1 L.union_ union_t1 L.edu_ edu_t1 L.inc_ inc_t1 L.ideo_ ideo_t1 female_ female white_ white working_1 working_t1 working_2 working_t1 L.working_ working_t1 L.working_wi working_t1"

local vlabsYP1 "workcls_t1 "Subj. working class_{t-1}" union_t1 "Union member_{t-1}" working_t1 "Employed_{t-1}" edu_t1 "Education_{t-1}" inc_t1 "Income_{t-1}" ideo_t1 "Ideology_{t-1}" female "Female" white "White" _cons "Constant""

local vdrop "edu_ inc_ working_ ideo_ *_bw *_wi"


*** TABLE 3. ***
* Subjective class as DV.
esttab m_12 m_23 m_123 m_123w using "Table_3.tex", replace  cells(b(fmt(3) star) se(fmt(3) par)) rename(`vnamesYP1') varlabels(`vlabsYP1') starlevels(+ 0.10 * 0.05 ** 0.01 *** 0.001) substitute(_{t-1} \$_{t-1}$ # X < $<$ + $^+$ \hline\hline \hline) mlabel("\shortstack[l]{Waves\\1973-1982}" "\shortstack[l]{Waves\\1982-1997}" "\shortstack[l]{Waves\\1973-1982-1997}" "\shortstack[l]{Waves\\1973-1982-1997\\(mean centered)}") eqlabels(none) nonum drop(lnsig2u `vdrop' union_) title(Panel Data Estimates of the Effect of Union Membership on Subjective Class\label{tab:results.panelWC})


*** TABLE 4. ***
* Saved first difference effects.
frame prfd: format %9.3f fd ll ul
frame prfd: tostring fd ll ul, replace usedisplayformat force
frame prfd: export excel "Table_4.xls", replace keepcellfmt firstrow(variables)


*** TABLE 5. ***
* Union membership as DV.
esttab m_rev12 m_rev23 m_rev123 m_rev123w using "Table_5.tex", replace  cells(b(fmt(3) star) se(fmt(3) par)) rename(`vnamesYP1') varlabels(`vlabsYP1') starlevels(+ 0.10 * 0.05 ** 0.01 *** 0.001) substitute(_{t-1} \$_{t-1}$ # X < $<$ + $^+$ \hline\hline \hline) mlabel("\shortstack[l]{Waves\\1973-1982}" "\shortstack[l]{Waves\\1982-1997}" "\shortstack[l]{Waves\\1973-1982-1997}" "\shortstack[l]{Waves\\1973-1982-1997\\(mean centered)}") eqlabels(none) nonum drop(lnsig2u `vdrop' workcls_) title(Panel Data Estimates of the Effect of Subjective Class on Union Membership\label{tab:results.panelU})



*******************************************************************************
***** Appendix tables.
*******************************************************************************


*** TABLE A3. ***
* IRT models to create measure of latent objective class.
* Difficulty parameters = cut / theta
esttab m_irt2 using "Table_A3.tex", replace cells("b(fmt(3) star) se(fmt(3) par)") eq(1,2,3) order(#1:Theta /inc5:cut* #2:Theta /edu5:cut* #3:Theta /egp5rev:cut* ) drop(year_*: /year_*: var(Theta)) varlabels(Theta "Discrim" cut1 "Cut 1" cut2 "Cut 2" cut3 "Cut 3" cut4 "Cut 4") eqlabels("Income" "" "Education" "" "EGP" "") mlabels(none) starlevels(+ 0.10 * 0.05 ** 0.01 *** 0.001) style(tex) substitute(_ \_ # X < $<$ + $^+$ \hline\hline \hline) title(Results for IRT Graded Response Model of Latent Objective Class\label{tab:irt}) 


*** TABLE A4. ***
use GSS_SubClass_clean.dta, clear
estpost tab subcls working 
esttab using "Table_A4.tex" , replace style(tex) cell(colpct(fmt(1))) unstack noobs varlabels(`e(labels)') eqlabels("Not working" "Working") nomtitle nonumber collabels(none) title(Cross Tabulation Between Subjective Class and Employment Status\label{tab:desc.subwork})


* GSS subjective class and unions results.

* Labels.
local vlabsGSS "2.objcls5 "Obj. working" 3.objcls5 "Obj. lower mid." 4.objcls5 "Obj. upper mid." 5.objcls5 "Obj. upper" 1.union "Union mem." 1.working "Employed" pid7 "Party ID" polviews "Ideology" age "Age" age2 "Age$^2$" 1.female "Female" 2.race "Black" 3.race "Other" 2.region4 "Midwest" 3.region4 "South" 4.region4 "West" _cons "Constant" 2.objcls5#1.union "\shortstack[l]{Obj. working\\ $\times$ union}" 3.objcls5#1.union "\shortstack[l]{Obj. lower mid.\\ $\times$ union}" 4.objcls5#1.union "\shortstack[l]{Obj. upper mid.\\ $\times$ union}" 5.objcls5#1.union "\shortstack[l]{Obj. upper\\ $\times$ union}""

*** TABLE A5. ***
esttab scls_ML scls_objXuni_ML using "Table_A5.tex" , replace unstack b(3) se(3) nobase noomitted drop(*.year) stats(N, fmt(0)) legend varwidth(0) style(tex) longtable substitute(_ \_ # X < $<$ + $^+$ \hline\hline \hline) varlabels(`vlabsGSS') starlevels(+ 0.10 * 0.05 ** 0.01 *** 0.001) mlabels("\shortstack{Subj. class additive model\\(working class is ref. category)}" "\shortstack{Subj. class interaction model\\(working class is ref. category)}") title(The Effect of Objective Class and Union Membership on Subjective Class\label{tab:results.gss}) eqlabels("Lower cls." "Middle cls." "Upper cls.") nonumbers refcat(2.objcls5 "\shortstack[l]{Obj. lower (ref.)}" 2.race "\shortstack[l]{White (ref.)}" 2.region4 "\shortstack[l]{Northeast (ref.)}", nolabel) 


*** TABLE A6. ***
* GSS subjective class and unions *logit models*.
esttab scls_WC scls_objXuni_WC using "Table_A6.tex" , replace unstack b(3) se(3) nobase noomitted drop(*.year) stats(N, fmt(0)) legend varwidth(0) style(tex) longtable substitute(_ \_ # X < $<$ + $^+$ \hline\hline \hline) varlabels(`vlabsGSS') starlevels(+ 0.10 * 0.05 ** 0.01 *** 0.001) eqlabels(none) nonumbers mlabels("Subj. class additive model" "Subj. class interaction model") title(Modeling the Effect of Objective Class and Union Membership on Subjective Class Using a Binary Dependent Variable to Measure Working Class Identity\label{tab:results.WC}) refcat(2.objcls5 "\shortstack[l]{Obj. lower (ref.)}" 2.race "\shortstack[l]{White (ref.)}" 2.region4 "\shortstack[l]{Northeast (ref.)}", nolabel) 


*** TABLE A7. ***
* GSS subjective class and unions *CEM*.
esttab scls_ML_cem scls_objXuni_ML_cem using "Table_A7.tex" , replace unstack b(3) se(3) nobase noomitted drop(*.year) stats(N, fmt(0)) legend varwidth(0) style(tex) longtable substitute(_ \_ # X < $<$ + $^+$ \hline\hline \hline) varlabels(`vlabsGSS' subcls_wc "Subjective class") starlevels(+ 0.10 * 0.05 ** 0.01 *** 0.001) mlabels("\shortstack{Subj. class additive model\\(working class is ref. category)}" "\shortstack{Subj. class interaction model\\(working class is ref. category)}") title(The Effect of Objective Class and Union Membership on Subjective Class Using Matched Data\label{tab:results.gss.cem}) eqlabels("Lower cls." "Middle cls." "Upper cls.") nonumbers refcat(2.objcls5 "\shortstack[l]{Obj. lower (ref.)}" 2.race "\shortstack[l]{White (ref.)}" 2.region4 "\shortstack[l]{Northeast (ref.)}", nolabel) 



* YPSS *full results*.

* Labels.
local vnamesYP2 "workcls_ workcls_t union_wi union_t edu_wi edu_t inc_wi inc_t ideo_wi ideo_t workcls_wi workcls_t union_ union_t edu_ edu_t inc_ inc_t ideo_ ideo_t working_ working_t working_wi working_t"

local vlabsYP2 "workcls_t "Subj. working class_{t}" workcls_t1 "Subj. working class_{t-1}" union_t "Union member_{t}" union_t1 "Union member_{t-1}" working_t "Employed_{t}" working_t1 "Employed_{t-1}" edu_t "Education_{t}" edu_t1 "Education_{t-1}" inc_t "Income_{t}" inc_t1 "Income_{t-1}" ideo_t "Ideology_{t}" ideo_t1 "Ideology_{t-1}" female "Female" white "White" workcls_bw "Subj. working class_{M}" union_bw "Union member_{M}" working_bw "Employed_{M}" edu_bw "Education_{M}" inc_bw "Income_{M}" ideo_bw "Ideology_{M}" _cons "Constant""


*** TABLE A9. ***
* Subjective class as DV *full results*.
esttab m_123 m_123w using "Table_A9.tex", replace  cells("b(fmt(3) star) se(fmt(3) par)") rename(`vnamesYP1' `vnamesYP2') varlabels(`vlabsYP2') starlevels(+ 0.10 * 0.05 ** 0.01 *** 0.001) substitute(_{M} \$_{M}$ _{t} \$_{t}$ _{t-1} \$_{t-1}$ # X < $<$ + $^+$ \hline\hline \hline) mlabel("\shortstack[l]{Waves\\1973-1982-1997}" "\shortstack[l]{Waves\\1973-1982-1997\\(mean centered)}") eqlabels(none) nonum drop(lnsig2u) title(Full Set of Results for Panel Data Estimates of the Effect of Union Membership on Subjective Class\label{tab:fullres.panelWC})


*** TABLE A10. ***
* Union membership as DV *full results*.
esttab m_rev123 m_rev123w using "Table_A10.tex", replace  cells("b(fmt(3) star) se(fmt(3) par)") rename(`vnamesYP1' `vnamesYP2') varlabels(`vlabsYP2') starlevels(+ 0.10 * 0.05 ** 0.01 *** 0.001) substitute(_{M} \$_{M}$ _{t} \$_{t}$ _{t-1} \$_{t-1}$ # X < $<$ + $^+$ \hline\hline \hline) mlabel("\shortstack[l]{Waves\\1973-1982-1997}" "\shortstack[l]{Waves\\1973-1982-1997\\(mean centered)}") eqlabels(none) nonum drop(lnsig2u) title(Full Set of Results for Panel Data Estimates of the Effect of Subjective Class on Union Membership\label{tab:fullres.panelU})


* YPSS *SEM models*.
local vlabs2 "workcls_1 "Subj. working class_{1973}$" union_1 "Union member_{1973}$" working_1 "Employed_{1973}$" edu_1 "Education_{1973}$" inc_1 "Income_{1973}$" ideo_1 "Ideology_{1973}$" female_1 "Female" white_1 "White" workcls_2 "Subj. working class_{1982}$" union_2 "Union member_{1982}$" working_2 "Employed_{1982}$" edu_2 "Education_{1982}$" inc_2 "Income_{1982}$" ideo_2 "Ideology_{1982}$" female_2 "Female" white_2 "White" _cons "Constant""


*** TABLE A11. ***
esttab m_gsem using "Table_A11.tex" , replace cells(b(fmt(3) star) se(fmt(3) par)) unstack varlabels(`vlabs2') starlevels(+ 0.10 * 0.05 ** 0.01 *** 0.001) substitute(_{ \$_{ # X < $<$ + $^+$ \hline\hline \hline) mlabels(none) nonum eqlabels("\shortstack[l]{Subj. working \\class_{1982}$}" "\shortstack[l]{Union \\member_{1982}$}" "\shortstack[l]{Subj. working \\class_{1997}$}" "\shortstack[l]{Union \\member_{1997}$}") title(Panel Data Estimates of Cross-Lagged Effects between Union Membership and Subjective Class\label{tab:results.panelSEM})



* GSS policy and subjective class results.

* Labels.
local vlabsGSS3 "1.subcls "Subj. lower" 3.subcls "Subj. middle" 4.subcls "Subj. upper" 1.objcls5 "Obj. lower" 3.objcls5 "Obj. lower mid." 4.objcls5 "Obj. upper mid." 5.objcls5 "Obj. upper" 1.union "Union mem." pid701 "Party ID" polviews01 "Ideology" age "Age" age2 "Age$^2$" 1.female "Female" 2.race "Black" 3.race "Other" 2.region4 "Midwest" 3.region4 "South" 4.region4 "West" _cons "Constant""


*** TABLE A12. ***
esttab m_govineq012 m_govhlppoor012 m_govhlpmed012 m_govdomore012 using "Table_A12.tex" , replace cells(b(fmt(3) star) se(fmt(3) par)) varlabels(`vlabsGSS3') starlevels(+ 0.10 * 0.05 ** 0.01 *** 0.001) substitute(_ \_ # X < $<$ + $^+$ \hline\hline \hline) mlabel("\shortstack[l]{Gov. reduce ineq.}" "\shortstack[l]{Gov. help poor}" "\shortstack[l]{Gov. help sick}" "\shortstack[l]{Gov. do more}") eqlabels(none) nonum nobase drop(*.year) title(The Effect of Subjective Class on Policy Attitudes\label{tab:results.subjpol2}) refcat(3.subcls "Subj. working (ref.)" 3.objcls5 "Obj. working (ref.)" 2.region4 "\shortstack[l]{Northeast (ref.)}", nolabel)


*** TABLE A13. ***
* CEM.
esttab m_govineq01_cem m_govhlppoor01_cem m_govhlpmed01_cem m_govdomore01_cem using "Table_A13.tex" , replace cells(b(fmt(3) star) se(fmt(3) par)) varlabels(`vlabsGSS3' subcls_wc "Subjective class") starlevels(+ 0.10 * 0.05 ** 0.01 *** 0.001) substitute(_ \_ # X < $<$ + $^+$ \hline\hline \hline) mlabel("\shortstack[l]{Gov. reduce ineq.}" "\shortstack[l]{Gov. help poor}" "\shortstack[l]{Gov. help sick}" "\shortstack[l]{Gov. do more}") eqlabels(none) nonum nobase drop(*.year) title(The Effect of Subjective Class on Policy Attitudes Using Matched Data\label{tab:results.subjpol.cem}) refcat(3.objcls5 "Obj. working (ref.)" 2.region4 "\shortstack[l]{Northeast (ref.)}", nolabel)


* CNEP models.

* Labels.
local vlabs2 "1.F_AsoTu "Union mem." inc5 "Income" edu "Education" pid_str "Partisan strength" polviews "Ideology" age "Age" age2 "Age$^2$" 1.female "Female" 1.white_nh "White" cut1 "Cut 1" cut2 "Cut 2" cut3 "Cut 3" _cons "Constant" 1.south "South" 2012.year "2012 survey""

local vord "1.F_AsoTu inc5 edu pid_str 1.female age age2 1.white_nh 1.south 2012.year"


*** TABLE A15. ***
* Main models.
esttab orginfo_full wrktlk_full using "Table_A15.tex" , replace b(3) se(3) nobase noomitted stats(N, fmt(0)) legend varwidth(0) style(tex) substitute(_ \_ # X < $<$ + $^+$ \hline\hline \hline) varlabels(`vlabs2') order(`vord') eqlabels(none) nonumbers starlevels(+ 0.10 * 0.05 ** 0.01 *** 0.001) mlabels("Received election info." "Discuss campaign at work") title(The Effect of Union Membership on Receiving Political Information and Discussing Politics at Work\label{tab:results.cnep}) refcat(1.white_nh "\shortstack[l]{Non-white\\(ref.)}" 2012.year "\shortstack[l]{2004 survey\\(ref.)}", nolabel)


*** TABLE A16. ***
* Model surveys separately by year.
esttab orginfo_04 orginfo_12 wrktlk_04 wrktlk_12 using "Table_A16.tex" , replace b(3) se(3) nobase noomitted stats(N, fmt(0)) legend varwidth(0) style(tex) substitute(_ \_ # X < $<$ + $^+$ \hline\hline \hline) varlabels(`vlabs2') eqlabels(none) nonumbers starlevels(+ 0.10 * 0.05 ** 0.01 *** 0.001) mlabels("2004 survey" "2012 survey" "2004 survey" "2012 survey") title(The Effect of Union Membership on Receiving Political Information and Discussing Politics at Work, Separate Models by Survey Year\label{tab:results.cnep.alt1}) refcat(1.white_nh "\shortstack[l]{Non-white\\(ref.)}", nolabel)


*** TABLE A17. ***
* Alternative models.
esttab wrktlk_reg wrktlk_2cat using "Table_A17.tex" , replace b(3) se(3) nobase noomitted stats(N, fmt(0)) legend varwidth(0) style(tex) substitute(_ \_ # X < $<$ + $^+$ \hline\hline \hline) varlabels(`vlabs2') order(`vord') eqlabels(none) nonumbers starlevels(+ 0.10 * 0.05 ** 0.01 *** 0.001) mlabels("OLS model" "Logit model") title(The Effect of Union Membership on Discussing Politics at Work, Alternative Models\label{tab:results.cnep.alt2}) refcat(1.white_nh "\shortstack[l]{Non-white\\(ref.)}" 2012.year "\shortstack[l]{2004 survey\\(ref.)}", nolabel)





